package cn.brickie.abstractfactory;

/***
 * 工厂创造器/生成器类，通过传递形状或颜色信息来获取工厂
 * @author Brickie
 * @date 2018/5/29 10:48
 */
class FactoryProducer {
    /***
     * 工厂类型创建
     * @param choice 类型
     * @return 工厂类
     */
    static AbstractFactory getFactory(Choice choice) {
        switch (choice) {
            case SHAPE:
                return new ShapeFactory();
            case COLOR:
                return new ColorFactory();
            default:
                return null;
        }
    }

    enum Choice {
        SHAPE,
        COLOR
    }
}
